package com.cloudknows.processer;

import com.cloudknows.Query;
import com.cloudknows.Response;
import com.cloudknows.parser.SemanticParser;
import com.cloudknows.resource.Resourcer;
import com.cloudknows.responser.Responser;
import com.cloudknows.semantic.Semantic;

public class Processer {
    Responser rspr = null;
    SemanticParser qp = null;

    public boolean init() {
        rspr = new Responser();
        qp = new SemanticParser();
        return Resourcer.load();
    }

    public String handle(String inputQuery) {
        Query query = new Query(inputQuery);
        Semantic st = qp.parse(query.getQueryText());
        Response rsp = rspr.doResponse(st);
        return rsp.format();

    }

}
